package de.lang.rollo.controller.logic.scheduling;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import de.lang.rollo.controller.enums.EventType;
import de.lang.rollo.controller.logic.GPIOFactory;
import de.lang.rollo.controller.model.RolloEvent;
import de.lang.rollo.controller.model.RolloMotor;

public class RolloJob implements Job{

	EventType event;
	RolloMotor rollo;
	
	public RolloJob(EventType event, RolloMotor rollo){
	}

	public void execute(JobExecutionContext context) throws JobExecutionException {
		event = (EventType) context.getJobDetail().getJobDataMap().get(RolloEvent.KEY_EVENT_TYPE);
		event = (EventType) context.getJobDetail().getJobDataMap().get(RolloEvent.KEY_EVENT_TYPE);
		switch (event){
		case DOWN:
			GPIOFactory.getFacade().driveDown(rollo);
			break;
		case UP:
			GPIOFactory.getFacade().driveUp(rollo);
			break;
			default:
		}
		
	}
}
